Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* add ts-jest #96

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

* add ts-jest #96

wants to merge 2 commits into from

Conversation

im-calvin
Copy link
Owner

  • attempt at testing translatedText. modules confuse me

* attempt at testing translatedText. modules confuse me
@@ -1,6 +1,9 @@
import { scheduleAnnounce } from "src/utils/schedule.js";
import { describe, test } from "node:test";
import { translateText } from "../src/translate/Translate.js";
Copy link
Owner Author

@im-calvin im-calvin Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intellisense is telling me to change this to .../Translate.js but when I run jest it only works when the path is .../Translate. Not sure why (config issue?)
Here's the error by intellisense:

Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../src/translate/Translate.js'?ts(2835)

Even when I change it to .../Translate, I get another import error inside Translate.ts:

    Cannot find module '../utils/env.js' from 'src/translate/Translate.ts'

    Require stack:
      src/translate/Translate.ts
      tests/setup.test.ts

      1 | import { v3 } from "@google-cloud/translate";
    > 2 | import { readEnv } from "../utils/env.js";

@im-calvin im-calvin linked an issue Aug 31, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write tests
1 participant